{extend name="base/base" /}
{block name="content"}
        <form class="layui-form" id="ajaxform" onsubmit="return false">
          <input type="hidden" value="{$data.id}" name="id" />
          <div class="layui-form-item">
            <label class="layui-form-label">新闻标题：</label>
            <div class="layui-input-block">
              <input name="title" required="" lay-verify="required" autocomplete="off" class="layui-input" type="text" value="{$data.title}">
            </div>
            <div class="layui-form-mid layui-word-aux"></div> 
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label">发布时间：</label>
            <div class="layui-input-block">
              <input name="time" required="" lay-verify="required" autocomplete="off" class="layui-input" type="text" value="{$data.time}">
            </div>
            <div class="layui-form-mid layui-word-aux"></div> 
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label">新闻地址：</label>
            <div class="layui-input-block">
              <input name="url" lay-vertype="tips" placeholder="新闻地址：" autocomplete="off" class="layui-input" type="text"  value="{$data.url}">
            </div>
            <div class="layui-form-mid layui-word-aux"></div>
          </div>
          <div class="layui-form-item">
            <div class="layui-input-block">
              <button class="layui-btn" lay-filter="formDemo" onclick="ajax()">立即提交</button>
              <button onclick="cancel()" class="layui-btn layui-btn-primary">取消</button>
            </div>
          </div>
        </form>
{/block}
{block name="script"}
<script>
    function ajax(){
      var post_data = $("#ajaxform").serialize();
      $.ajax({
        url:'',
        type:'POST',
        data:post_data,
        success:function(ret){
          if (ret.code == 0) {
            window.location.href=document.referrer;
          } else {
            layer.msg(ret.msg);
          }
        }
      });
    }
    function cancel(){
    window.location.href=document.referrer;
  }
</script>
{/block}
